/**
 * Copyright (c) 2009 blurredVision
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
 * associated documentation files (the "Software"), to deal in the Software without restriction, 
 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 
 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or 
 * substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 
 * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT 
 * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
#ifndef __GUI_LABEL_H__
#define __GUI_LABEL_H__

#pragma once

#include "Component.h"
#include "IChangeListener.h"
#include "StringDisplay.h"

#include <string>

namespace gui {

/// Text alignment for Labels and other text fields
enum GUI_EXPORT eTextAlign {
	LEFT = 0, 
	CENTER, 
	RIGHT,
	BLOCK
};

/**
 * \ingroup coreGUI
 *
 * The GUI Label class.<br>
 * A label is just a small text to be displayed inside a GUI.
 *
 * \date 03-28-2007
 *
 * \author juckel
 * \author altjohann
 *
 */
class GUI_EXPORT Label :
	public Component, 
	public IChangeObserver,
	public StringDisplay
{
public:
	Label(void);
	/// Create a label using a text and an alignment
	Label(const std::string &text, eTextAlign align = LEFT);
	virtual ~Label(void);

	/// Set a new text
	void setText(const std::string &text);

	/// Return the label text
	const std::string& getText() const;

	virtual void displayString(const std::string &_str);

	/// Draw the gui element
	virtual void draw();

	/// Return the type of the gui element
	virtual inline const int getGUIType() const { return GUI_LABEL; }

	/*
	*	Set the dimension of this label
	*	depending length of text and heights of used font
	*/
	void matchSizeToText();

protected:
	std::string   m_sText;
	eTextAlign    m_eAlignment;
};

} // namespace

#endif
